package personal.cc.friday.common;

import com.fasterxml.jackson.annotation.JsonFormat;
import jakarta.persistence.Column;
import jakarta.persistence.MappedSuperclass;
import jakarta.persistence.PrePersist;
import jakarta.persistence.PreUpdate;
import lombok.AllArgsConstructor;

import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.sql.Update;

import java.io.Serializable;
import java.sql.Date;

@MappedSuperclass
@Data
@NoArgsConstructor
@AllArgsConstructor
public class BaseModel implements Serializable {
    private static final long serialVersionUID = 1L;

    private String id;

    @Column(updatable = false)
    @JsonFormat(pattern = "yyy-MM-dd HH:mm:ss")
    private Date createTime;

    private String updateBy;

    @JsonFormat(pattern = "yyy-MM-dd HH:mm:ss")
    private Date updateTime;

    private String remarks;

//    @PrePersist
//    protected void onCreate() {
//        createTime=new Date();
//    }
//
//    @PreUpdate
//    protected void onUpdate() {
//        updateTime=new Date();
//    }
}
